<!doctype html>
<html>
<head>
    <title>Access API through CORS</title>
</head>
<body>
  <script>
    var url = 'http://localhost:8080/api'
    fetch(url)
      .then(response => {
        if (response.ok) {
          return response.json();
        } else {
          throw new Error('Failed to fetch data');
        }
      })
      .then(data => {
        document.body.innerHTML += data.message;
      })
      .catch(error => {
        document.body.innerHTML += "ERROR: " + error;
      });
  </script>
</body>
</html>
